package com.ruoyi.project.wenyanwen.generate.convert;


import com.ruoyi.project.dict.cizunew.domain.Cizu;
import com.ruoyi.project.wenyanwen.generate.domain.sqlite.CizuFullSqlite;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.stereotype.Component;

import java.util.ArrayList;
import java.util.List;

/**
 * @author jackyshi
 */
@Component
public class CizuFullConvert extends BaseCizuConvert {

    protected static Log logger = LogFactory.getLog(CizuFullConvert.class);

    @Override
    public List<CizuFullSqlite> convert(List<?> list) {

        List<CizuFullSqlite> l = new ArrayList<>();

        for (Object obj : list) {
            Cizu cizu = (Cizu) obj;
            CizuFullSqlite model = new CizuFullSqlite();
            model.set_id(cizu.getId().intValue());
            model.setCi(cizu.getCi());
            String zhujie = buildDesc(cizu);
            if (StringUtils.isEmpty(zhujie)) {
                continue;
            }
            model.setZhujie(encrypt(zhujie));
            l.add(model);
        }

        return l;
    }
}
